package com.song;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import com.spring4all.swagger.EnableSwagger2Doc;

/**
 * 
 * @description : --@EnableSwagger2Doc注解是我们自制Swagger Starter中提供的自定义注解，通过该注解会初始化默认的Swagger文档设置。
 * 下面还创建了一个通过Spring MVC编写的HTTP接口，用来后续在文档中查看使用。
 * @date        : 2018-08-14 12:24
 * @author      : leoSong
 *
 */
@EnableSwagger2Doc
@EnableDiscoveryClient
@SpringBootApplication
public class SwaggerServiceAApplication {

  @RestController
  class AaaController {
    @Autowired
    DiscoveryClient discoveryClient;

    @GetMapping("/service-a")
    public String dc() {
      String services = "Services: " + discoveryClient.getServices();
      System.out.println(services);
      return services;
    }
  }

  public static void main(String[] args) {
    SpringApplication.run(SwaggerServiceAApplication.class, args);
  }
}
